#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, UILabelCountingMethod) {
    UILabelCountingMethodEaseInOut,
    UILabelCountingMethodEaseIn,
    UILabelCountingMethodEaseOut,
    UILabelCountingMethodLinear
};

typedef NSString* (^UICountingLabelFormatBlock)(CGFloat value);
typedef NSAttributedString* (^UICountingLabelAttributedFormatBlock)(CGFloat value);

@interface CountingLabel : UILabel

@property (nonatomic, strong) NSString *descripStr;
@property (nonatomic, strong) UIColor *descripColor;//变化值前半部分颜色
@property (nonatomic, strong) UIFont *descripFont;  //变化值前半部分字体
@property (nonatomic, assign) float desBasLine;     //变化值前半部分对齐值
@property (nonatomic, strong) UIColor *valueColor;
@property (nonatomic, strong) UIFont *valueFont;
@property (nonatomic, strong) NSString *subValue;
@property (nonatomic, strong) NSString *unitStr;
@property (nonatomic, strong) UIColor *unitColor;   //变化值后半部分颜色
@property (nonatomic, strong) UIFont *unitFont;     //变化值后半部分字体
@property (nonatomic, strong) NSString *iconImage;
@property (nonatomic, strong) NSString *format;

@property (nonatomic, assign) UILabelCountingMethod method;
@property (nonatomic, assign) NSTimeInterval animationDuration;

@property (nonatomic, copy) UICountingLabelFormatBlock formatBlock;
@property (nonatomic, copy) UICountingLabelAttributedFormatBlock attributedFormatBlock;
@property (nonatomic, copy) void (^completionBlock)();

-(void)countFrom:(CGFloat)startValue to:(CGFloat)endValue;
-(void)countFrom:(CGFloat)startValue to:(CGFloat)endValue withDuration:(NSTimeInterval)duration;

-(void)countFromCurrentValueTo:(CGFloat)endValue;
-(void)countFromCurrentValueTo:(CGFloat)endValue withDuration:(NSTimeInterval)duration;

-(void)countFromZeroTo:(CGFloat)endValue;
-(void)countFromZeroTo:(CGFloat)endValue withDuration:(NSTimeInterval)duration;

- (CGFloat)currentValue;

@end

